<h2>DESCRIPTION</h2>

<em>v.what.vect</em> transfers attributes from the <b>query_map</b>'s
attribute table into the <b>map</b>'s attribute table. The module can
be used to transfer attributes from the table of a polygon map into the
attribute table of a point vector map, as well as the other way around,
i.e., from a point map into the attribute table of a polygon map (See
examples). The script is based on <em>v.distance</em>.

<h2>NOTES</h2>

The upload <b>column</b> into which the query results are stored must be
present in <b>map</b>. Use <em>v.db.addcolumn</em> to add one if needed.
<p>Use the <b>dmax</b> parameter to control the query distance tolerance, i.e.,
how far <b>map</b>'s points/centroids can be from the <b>query_map</b> features. 
For further options, use <em>v.distance</em>.
<p>In case of a multipoint input <b>map</b> with several points having the
same category number, it can happen that the query result is NULL if the same
category number falls into different <b>query_map</b> polygons.
<p>When transferring attributes from a point map into a polygon map,
<b>dmax</b> has to be larger than zero, i.e., it will be determined by the
distance between query points and polygon centroids. Importantly, distance
is in meters for latitude-longitude locations.
<p>In case that one or both input vector maps are 3D, features need to 
touch also in the 3rd dimension (z coordinate) in order to transfer
attributes.

<h2>EXAMPLES</h2>

In this example, the 'hospitals' point map in the North Carolina location is
copied to the current mapset, a new attribute column is added and the urban
names from the 'urbanarea' polygon map are transferred to hospital points
locations in 'myhospitals' map:

<div class="code"><pre>
g.copy vect=hospitals,myhospitals
v.db.addcolumn myhospitals column="urb_name varchar(25)"
v.what.vect myhospitals query_map=urbanarea column=urb_name query_column=NAME
# verification:
v.db.select myhospitals
</pre></div>
<p>
In this example, city names, population data and others from
<a href="http://download.geonames.org/export/dump/">Geonames.org country files</a> are
transferred to selected EU CORINE landuse/landcover classes
("Continuous urban fabric", 111, and "Discontinuous urban fabric", 112).
Note: The example is in UTM projection to which the input maps have been
projected beforehand.

<div class="code"><pre>
# extract populated places from geonames
v.extract geonames_IT where="featurecla='P'" output=geonames_IT_cities
# add new column 
v.db.addcol corine_code111_112_cities column="gnameid double precision"
# transfer geonameid (3000m maximal distance between points and centroids)
v.what.vect corine_code111_112_cities query_map=geonames_IT_cities column=gnameid \
            query_column=geonameid dmax=3000
# now gnameid can be used for v.db.join to join further
# attributes from geonames.org
</pre></div>

<h2>SEE ALSO</h2>

<em>
<a href="v.db.addcolumn.html">v.db.addcolumn</a>,
<a href="v.db.select.html">v.db.select</a>,
<a href="v.distance.html">v.distance</a>,
<a href="v.rast.stats.html">v.rast.stats</a>,
<a href="v.what.rast.html">v.what.rast</a>,
<a href="v.what.rast3.html">v.what.rast3</a>,
<a href="v.vect.stats.html">v.vect.stats</a>
</em>


<h2>AUTHOR</h2>

Markus Neteler

<!--
<p>
<i>Last changed: $Date$</i>
-->
